using System.Collections.Generic;
using Abp.Runtime.Session;
using Abp.Timing.Timezone;
using Dyan.PlatformSystem.DataExporting.Excel.EpPlus;
using Dyan.PlatformSystem.Customers.Dtos;
using Dyan.PlatformSystem.Dto;
using Dyan.PlatformSystem.Storage;

namespace Dyan.PlatformSystem.Customers.Exporting
{
    public class CustomerAccountsExcelExporter : EpPlusExcelExporterBase, ICustomerAccountsExcelExporter
    {

        private readonly ITimeZoneConverter _timeZoneConverter;
        private readonly IAbpSession _abpSession;

        public CustomerAccountsExcelExporter(
            ITimeZoneConverter timeZoneConverter,
            IAbpSession abpSession,
			ITempFileCacheManager tempFileCacheManager) :  
	base(tempFileCacheManager)
        {
            _timeZoneConverter = timeZoneConverter;
            _abpSession = abpSession;
        }

        public FileDto ExportToFile(List<GetCustomerAccountForViewDto> customerAccounts)
        {
            return CreateExcelPackage(
                "CustomerAccounts.xlsx",
                excelPackage =>
                {
                    var sheet = excelPackage.Workbook.Worksheets.Add(L("CustomerAccounts"));
                    sheet.OutLineApplyStyle = true;

                    AddHeader(
                        sheet,
                        L("Name"),
                        L("Email"),
                        L("PhoneNum"),
                        L("PassWord")
                        );

                    AddObjects(
                        sheet, 2, customerAccounts,
                        _ => _.CustomerAccount.Name,
                        _ => _.CustomerAccount.Email,
                        _ => _.CustomerAccount.PhoneNum,
                        _ => _.CustomerAccount.PassWord
                        );

					

                });
        }
    }
}
